package com.design.pattern.state.common;

import com.design.pattern.state.service.State;
import com.design.pattern.state.service.impl.AllowState;
import com.design.pattern.state.service.impl.InsertPasswordState;
import com.design.pattern.state.service.impl.LimitState;

/**
 * 根据权限生成的具体的状态处理的工厂类
 */
public final class UserRoomStateFactory {
    /**
     * 创建具体的访问权限类
     * @param auth 访问权限
     * @return
     */
    public static State createStateHandler(RoomAuth auth) {
        switch (auth) {
            case ALLOW:
                return new AllowState();
            case INSERT_PASSWORD:
                return new InsertPasswordState();
            default:
                return new LimitState();
        }
    }
}
